#ifndef SCHEDULER_H_
#define SCHEDULER_H_

/*INCLUDES *******************************************************************/
#include "ses_common.h"

/* DEFINES & MACROS **********************************************************/

#define SCHEDULER_ENTRIES		20
#define EMPTY_TASK				0
#define EXPIRE_STD_TIME			1


/* TYPES ********************************************************************/

/**type of function pointer for tasks
 */
typedef void (*task_t)(void);

typedef struct {
	uint8_t hour;
	uint8_t minute;
	uint8_t second;
	uint16_t milli;
}type_timeRTC;

/* FUNCTION PROTOTYPES *******************************************************/

/**
 * returns system time in real time
 */
void scheduler_getTimeRTC(type_timeRTC *time);

/**
 * sets system time from real time
 */
void scheduler_setTimeRTC(const type_timeRTC *time);

/**
 * returns system time in milliseconds
 */
uint32_t scheduler_getTime();

/**
 * sets system time in milliseconds
 */
void scheduler_setTime(uint32_t); //

/**
 * Initializes the task scheduler.
 */
void scheduler_init();

/**
 * Runs scheduler in an infinite loop.
 */
void scheduler_run();

/**
 * Adds new task to the scheduler. A scheduled task is executed once after the given
 * time period.
 *
 * @param task		valid pointer to task
 * @param expire	time period
 */
bool scheduler_add( task_t task, uint16_t expire);

/**
 * Removes a timer task from the scheduler.
 *
 * @param task	pointer to timer
 * */
void scheduler_remove(task_t task);

#endif /* SCHEDULER_H_ */
